this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};this.BX.Landing.UI=this.BX.Landing.UI||{};(function(t,e,i,n,a,l,o,s){"use strict";var r,u,d;var c=function(t){babelHelpers.inherits(e,t);function e(t){var i;babelHelpers.classCallCheck(this,e);i=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(e).call(this,t));i.setEventNamespace("BX.Landing.UI.Field.RadioButtonField");i.subscribeFromOptions(o.fetchEventsFromOptions(t));n.Dom.addClass(i.layout,"landing-ui-field-radio-button");n.Dom.replace(i.input,i.getLayout());if(n.Type.isBoolean(i.options.selectable)){i.setSelectable(i.options.selectable)}else{i.setSelectable(true)}i.options.items.forEach((function(t){i.appendItem(t)}));if(i.options.value){i.setValue(i.options.value,true)}else{i.setValue(i.options.items[0].id,true)}return i}babelHelpers.createClass(e,[{key:"getLayout",value:function t(){var e=this;return this.cache.remember("remember",(function(){return n.Tag.render(r||(r=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="landing-ui-field-radio-button-layout" data-selector="','"></div>\n\t\t\t'])),e.selector)}))}},{key:"appendItem",value:function t(e){var i=n.Tag.render(u||(u=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div \n\t\t\t\tclass="landing-ui-field-radio-button-item','" \n\t\t\t\tdata-value="','"\n\t\t\t\tonclick="','"\n\t\t\t>\n\t\t\t\t<div class="landing-ui-field-radio-button-item-icon ','"></div>\n\t\t\t\t<div class="landing-ui-field-radio-button-item-text">\n\t\t\t\t\t<span>',"</span>\n\t\t\t\t</div>\n\t\t\t\t","\n\t\t\t</div>\n\t\t"])),e.disabled?" landing-ui-disabled":"",e.id,this.onItemClick.bind(this,e),e.icon,e.title,e.soon?this.createSoonLabel():"");if(n.Type.isPlainObject(e.button)){var a=new l.Button({color:l.Button.Color.PRIMARY,size:l.Button.Size.EXTRA_SMALL,text:e.button.text,round:true,events:{click:e.button.onClick}});a.renderTo(i)}n.Dom.append(i,this.getLayout())}},{key:"onItemClick",value:function t(e,i){i.preventDefault();if(this.options.selectable!==false){babelHelpers.toConsumableArray(this.getLayout().children).forEach((function(t){n.Dom.removeClass(t,"landing-ui-field-radio-button-item-active")}));n.Dom.addClass(i.currentTarget,"landing-ui-field-radio-button-item-active")}this.emit("onChange",{item:e})}},{key:"getValue",value:function t(){var e=babelHelpers.toConsumableArray(this.getLayout().children).find((function(t){return n.Dom.hasClass(t,"landing-ui-field-radio-button-item-active")}));if(e){return n.Dom.attr(e,"data-value")}return""}},{key:"setValue",value:function t(e,i){var a=babelHelpers.toConsumableArray(this.getLayout().children);a.forEach((function(t){n.Dom.removeClass(t,"landing-ui-field-radio-button-item-active")}));var l=a.find((function(t){return String(n.Dom.attr(t,"data-value"))===String(e)}));if(l){if(this.options.selectable!==false){n.Dom.addClass(l,"landing-ui-field-radio-button-item-active")}if(!i){this.emit("onChange",{item:l})}}}},{key:"getSelectable",value:function t(){return n.Text.toBoolean(this.cache.get("selectable"))}},{key:"setSelectable",value:function t(e){this.cache.set("selectable",n.Text.toBoolean(e))}},{key:"isSelectable",value:function t(){return n.Text.toBoolean(this.cache.get("selectable"))}},{key:"createSoonLabel",value:function t(){return n.Tag.render(d||(d=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-ui-field-radio-button-item-soon-label">\n\t\t\t\t',"\n\t\t\t</div>\n\t\t"])),s.Loc.getMessage("LANDING_UI_BASE_PRESET_PANEL_SOON_LABEL"))}}]);return e}(a.BaseField);t.RadioButtonField=c})(this.BX.Landing.UI.Field=this.BX.Landing.UI.Field||{},BX,BX,BX,BX.Landing.UI.Field,BX.UI,BX.Landing.UI.Component,BX.Landing);
//# sourceMappingURL=radiobuttonfield.bundle.map.js